<?php
/**
 * 用户答题记录表
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserQuestionAnswerTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_question_answer', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_question_id')->comment('用户题组ID');
            $table->integer('question_id')->comment('题ID');
            $table->string('answer')->comment('答案');
            $table->string('right_answer')->comment('正确答案');
            $table->timestamps();
            $table->softDeletes();
        });
        //添加表注释
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."user_question_answer` comment'用户答题记录表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_question_answer');
    }
}
